package wqh.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import wqh.domain.SystemLog;

import java.util.List;

/**
 * Created by devts on 2016/9/26.
 */
public interface SystemLogDao {

    @Insert("INSERT INTO system_log (log_time_str, log_detail, log_type, user_name) VALUES(#{log_time_str}, #{log_detail}, #{log_type}, #{user_name})")
    int insertRecordSample(SystemLog systemLog);

    @Select("SELECT * FROM system_log ORDER BY id DESC")
    List<SystemLog> findAllRecord();

    @Select("SELECT * FROM system_log WHERE log_type = #{1}")
    List<SystemLog> findAllByLogType(String log_type);

    @Select("SELECT * FROM system_log WHERE log_time_str >= #{1}")
    List<SystemLog> findAllStart(String start);

    @Select("SELECT * FROM system_log WHERE log_time_str <= #{1}")
    List<SystemLog> findAllEnd(String end);

    @Select("SELECT * FROM system_log WHERE log_time_str >= #{0} and log_time_str <= #{1}")
    List<SystemLog> findAllStartEnd(String start, String end);

    @Select("SELECT * FROM system_log WHERE log_type = #{0} and log_time_str >= #{1}")
    List<SystemLog> findAllLogTypeStart(String log_type, String start);

    @Select("SELECT * FROM system_log WHERE log_type = #{0} and log_time_str <= #{1}")
    List<SystemLog> findAllLogTypeEnd(String log_type, String end);

    @Select("SELECT * FROM system_log WHERE log_type = #{0} and log_time_str >= #{1} and log_time_str <= #{2}")
    List<SystemLog> findAllLogTypeStartEnd(String log_type, String start, String end);

    int count();

}
